import numpy as np
import pandas as pd


def load_analysis(path):
    data = pd.read_csv(path)
    data.info()
    # # print(data.head())
    # # print(data.columns)
    # print("="*20)
    # # cat_cols = ['BusinessTravel', 'Department', 'Gender', 'OverTime']
    # # data = pd.get_dummies(data, columns=cat_cols)
    # # data.info()
    # print("=" * 20)
    # sns.boxplot(x=data['MonthlyIncome'])
    # plt.show()
    # print("=" * 20)
    # print(data['Attrition'].value_counts(normalize=True))  # 查看正负样本比例
    # print("=" * 20)
    # plt.figure(figsize=(10, 6))
    # sns.countplot(x='OverTime', hue='Attrition', data=data)
    # plt.show()
    # print("=" * 20)
    # sns.boxplot(x=data['DistanceFromHome'])
    # plt.show()
    return data


def apply_log_transform(df, numeric_features):
    df = df.copy()
    skewness_cols = []
    for col in numeric_features:
        df[col] = np.log1p(df[col])
    return df

def get_log_transform_cols(df, numeric_features):
    df = df.copy()
    skewness_cols = []
    for col in numeric_features:
        skewness = df[col].skew()
        if abs(skewness) > 0.5:
            skewness_cols.append(col)
    return skewness_cols